import unittest

input_output=[['''\
01 34 46 31 55 21 16 88 87 87
32 40 82 40 43 96 08 82 41 86
30 16 24 18 04 54 65 96 38 48
32 00 99 90 24 75 89 41 04 01
11 80 31 83 08 93 37 96 27 64
09 81 28 41 48 23 68 55 86 72
64 61 14 55 33 39 40 18 57 59
49 34 50 81 85 12 22 54 80 76
18 45 50 26 81 95 25 14 46 75
22 52 37 50 37 40 16 71 52 17''',615],
['''\
48 68 36 80 39 53 76 52 73 08
44 13 88 03 92 07 78 17 63 39
98 56 17 72 30 44 96 55 88 49
60 56 41 05 16 61 58 76 35 39
26 82 23 76 63 62 96 32 01 85
14 41 89 24 79 51 72 39 99 21
51 36 52 66 78 09 98 22 81 32
16 88 05 20 70 84 20 63 39 82
34 73 18 04 35 40 34 85 51 51
89 43 16 79 64 78 93 44 41 12''',721],]

if __name__ == "__main__":    
    a=[map(int,raw_input().split()) for i in range(10)];
    print max(map(sum,a+zip(*a)))
    
class GridComputingTest(unittest.TestCase):
    def grid3(self,input):
        a=[[int(j) for j in i.split()] for i in input.split("\n")]
        return max(map(sum,a+zip(*a)))
    def grid2(self,input):
        a=map(int,input.split())
        return max(map(lambda x:sum(a[x:x+10]),range(10))
                   +map(lambda x:sum(a[x::10]),range(10)))        
    def grid1(self,input):
        a=map(int,input.split())
        return max([sum(a[i:i+10]) for i in range(10)]
                   +[sum(a[i::10]) for i in range(10)])
    def grid0(self,input):
        a=input.split()
        return max([sum(map(int,a[i:i+10])) for i in range(10)]
                   +[sum(map(int,a[i::10])) for i in range(10)])        

    def test_grid(self):
        for attr in dir(self):
            if 0 == attr.find('grid'):
                for data in input_output:
                    self.assertEquals(data[1], getattr(self,attr)(data[0]))
    def test_grid_cmd(self):
        import os        
        for inout in input_output:
            fn='data.txt'                
            f=file(fn,'w')
            f.write(inout[0])
            f.close()            
            self.assert_(str(inout[1]) in os.popen("python %s < %s"%(__file__,fn)).read())
            os.remove(fn)
  
    